package com.demo.algorithm.jdk8;

import java.util.Random;
import java.util.function.Supplier;

/**
 * <p>
 * 函数式接口之Supplier接口
 * </p>
 *
 * @author yanyg
 * @date 2024/3/14 16:20
 */
public class SupplierWithLambda {
    public static void main(String[] args) {
        Supplier<String> s1 = () -> "Hello World!";
        System.out.println(s1.get());

        Random random = new Random();
        Supplier<Integer> s2 = () -> random.nextInt(10);
        System.out.println(s2.get());
    }
}